var express = require('express')

const app = express()

const axios = require('axios');
const apiRoutes = express.Router();
const devRequest = require('./src/api/devApi/devRequest')
const bodyParser = require('body-parser')


const urlencodedParser = bodyParser.urlencoded({ extended: false })
apiRoutes.post('/worker/person', urlencodedParser, devRequest.workerPerson)
apiRoutes.post('/wechat/webEmpower/jsConfig', urlencodedParser, devRequest.shareConfig)
apiRoutes.post('/worker/jobList', urlencodedParser, devRequest.job)
apiRoutes.get('/tag', urlencodedParser, devRequest.tag)
apiRoutes.post('/company/describe', urlencodedParser, devRequest.describe)
apiRoutes.get('/industry', urlencodedParser, devRequest.industry)
apiRoutes.get('/area', urlencodedParser, devRequest.area)
apiRoutes.post('/worker/job/star', urlencodedParser, devRequest.star)
apiRoutes.get('/worker/job/show', devRequest.jobDetail)
apiRoutes.post('/worker/company', urlencodedParser, devRequest.company)
apiRoutes.post('/worker/show', urlencodedParser, devRequest.resumeShow)
apiRoutes.post('/worker/showDemand', urlencodedParser, devRequest.showDemand)
apiRoutes.post('/worker/me', urlencodedParser, devRequest.wokerMe)
apiRoutes.post('/company/me', urlencodedParser, devRequest.companyMe)
apiRoutes.post('/worker/job/starred', urlencodedParser, devRequest.workerStarred)
apiRoutes.post('/worker/job/applied', urlencodedParser, devRequest.workerApplied)
apiRoutes.post('/position', urlencodedParser, devRequest.positionList)
apiRoutes.post('/worker/demand', urlencodedParser, devRequest.editDemand)
apiRoutes.post('/worker/resume', urlencodedParser, devRequest.editResume)
apiRoutes.post('/company/company/license', urlencodedParser, devRequest.license)
apiRoutes.post('/company/company/showLicense', urlencodedParser, devRequest.showLicense)
apiRoutes.post('/company/resume', urlencodedParser, devRequest.companyResume)
apiRoutes.post('/company/resume/item', urlencodedParser, devRequest.companyResumeItem)
apiRoutes.post('/company/resume/refuse', urlencodedParser, devRequest.refuseResume)
apiRoutes.post('/company/resume/call', urlencodedParser, devRequest.callResume)
apiRoutes.post('/company/company/show', urlencodedParser, devRequest.companyShow)
apiRoutes.post('/company/job/list', urlencodedParser, devRequest.companyJobList)
apiRoutes.post('/company/job/describe', urlencodedParser, devRequest.editJob)
apiRoutes.post('/company/job/show', urlencodedParser, devRequest.companyjobDetail)
apiRoutes.post('/company/job/offline', urlencodedParser, devRequest.companyjobDetail)
apiRoutes.post('/worker/job/apply', urlencodedParser, devRequest.jobApply)
apiRoutes.post('/company/company/list', urlencodedParser, devRequest.myCompany)
apiRoutes.post('/worker/wallet', urlencodedParser, devRequest.workerWallet)
apiRoutes.post('/worker/wallet/log', urlencodedParser, devRequest.workerWalletLog)
apiRoutes.post('/company/resume/buy', urlencodedParser, devRequest.buyResume)
apiRoutes.post('/worker/job/complaint', urlencodedParser, devRequest.complaint)
apiRoutes.post('/company/resume/order', urlencodedParser, devRequest.resumeOrder)
apiRoutes.post('/company/wallet/log', urlencodedParser, devRequest.walletLog)
apiRoutes.post('/index/resolveSaas', urlencodedParser, devRequest.getSaas)
apiRoutes.get('/worker/apply-withdraw', urlencodedParser, devRequest.applyWithdraw)
apiRoutes.post('/worker/resumev2', urlencodedParser, devRequest.resumev2)
apiRoutes.post('/poster/companyPoster', urlencodedParser, devRequest.CompanyPoster)
apiRoutes.post('/poster/JobPoster', urlencodedParser, devRequest.JobPoster)
apiRoutes.post('/worker/protocol', urlencodedParser, devRequest.protocol)
apiRoutes.post('/company/job/resumePoolCategory', urlencodedParser, devRequest.resumePoolCategory)
apiRoutes.post('/company/job/resumePool', urlencodedParser, devRequest.resumePool)
//phoneLogin.js
apiRoutes.post('/login', urlencodedParser, devRequest.phoneLogin)
apiRoutes.post('/login/wechatMPAuthorize', urlencodedParser, devRequest.userInfo)
apiRoutes.post('/company/job/topList', urlencodedParser, devRequest.topList)
apiRoutes.post('/company/job/buyTopList', urlencodedParser, devRequest.buyTopList)
apiRoutes.post('/wap/user/verifyPhone', urlencodedParser, devRequest.verifyPhone)
apiRoutes.get('/oss/sign', urlencodedParser, devRequest.ossSign)
apiRoutes.post('/company/wallet/recharge/:aid', urlencodedParser, devRequest.recharge)
apiRoutes.post('/company/member/memberList', urlencodedParser, devRequest.memberList)
apiRoutes.post('/company/member/buyMember', urlencodedParser, devRequest.buyMember)
apiRoutes.post('/company/member/buyMemberMenu', urlencodedParser, devRequest.buyMemberMenu)+

app.use('/', apiRoutes)
app.use(express.static('./dist_h5'))

module.exports = app.listen(8088,'192.168.10.139', function(err){
    if(err) {
        console.log(err)
        return
    }
    console.log('listening at http://192.168.10.139:' + 8088 + '\n')
})